//  this library.
enum FirstTypeEnum {
  singleChoice(desc: "单选题", code: 1),
  multipleChoice(desc: "多选题", code: 2),
  judgment(desc: "判断题", code: 3),
  fill(desc: "填空题", code: 4),
  text(desc: "简答题", code: 5),
  combination(desc: "组合题", code: 6),
  indefiniteMultipleChoice(desc: "不定项选择题", code: 7),
  ;

  final String desc;

  final int code;

  const FirstTypeEnum({
    required this.desc,
    required this.code,
  });

  static FirstTypeEnum? getFirstType(String type) {
    var values = FirstTypeEnum.values;
    for (var value in values) {
      if (value.name == type) {
        return value;
      }
    }
    return null;
  }

  static FirstTypeEnum getFirstTypeByCode(int code) {
    var values = FirstTypeEnum.values;
    for (var value in values) {
      if (value.code == code) {
        return value;
      }
    }
    return FirstTypeEnum.singleChoice;
  }
}
